package com.example.phoneshop.controller.admin;

import com.example.phoneshop.config.Config;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("adminTest")
public class AdminTestController {
    private String[] menu;
    @RequestMapping(value = "test", method = RequestMethod.GET)
    public ModelAndView test(HttpServletRequest request){
        ModelAndView model = new ModelAndView("admin/index/test");
        // 获取导航栏的active数组
        menu = Config.getMenu();
        model.addObject("title", "模版文件测试");
        model.addObject("classurl", request.getContextPath() + "/admin/index");
        model.addObject("classname", "首页");
        menu[1] = "active";
        model.addObject("menu", menu);
        return model;
    }
}
